<?php
/** @var LinkController $this */
/** @var Link $model */

$this->pageTitle = '链接';

$this->breadcrumbs = array(
	'链接',
);
?>

	<div class="page-header">
		<h1>链接 <?php echo CHtml::link('创建', array('create'), array('class' => 'btn btn-link')); ?> </h1>
	</div>
<?php
$form = $this->beginWidget('bootstrap.widgets.TbActiveForm', array(
	'type' => 'horizontal',
));
$actions = array(
	'' => '批量操作',
	'delete' => '删除',
);
?>
<?php
$this->widget('bootstrap.widgets.TbExtendedGridView', array(
	'id' => 'link-grid',
	'dataProvider' => $model->with('category')->search(),
	'bulkActions' => array(
		'class' => 'YBulkActions',
		'align' => 'left',
		'actionButtons' => $actions,
	),
	'filter' => $model,
	'columns' => array(
		array(
			'name' => 'id',
			'class' => 'CCheckBoxColumn',
			'selectableRows' => 2,
			'checkBoxHtmlOptions' => array('name' => 'ids[]'),
		),
		'name',
		array(
			'name' => 'category_id',
			'value' => '$data->category ? $data->category->name : null',
			'filter' => $model->getCategoryList(),
		),
		array(
			'name' => 'visible',
			'type' => 'boolean',
			'filter' => array('0' => '否', '1' => '是'),
			'class' => 'bootstrap.widgets.TbToggleColumn',
			'toggleAction' => 'link/toggle',
			'checkedButtonLabel' => '可见',
			'uncheckedButtonLabel' => '不可见',
		),
		array(
			'name' => 'create_time',
			'class' => 'YDatetimeColumn',
			'type' => 'date',
			'filter' => YUtil::timeFilterList(),
		),
		array(
			'class' => 'YInputColumn',
			'name' => 'weight',
			'inputHtmlOptions' => array('name' => 'weight')
		),
		array(
			'class' => 'bootstrap.widgets.TbButtonColumn',
		),
	),
));
?>
	<div class="text-right">
		<?php $this->widget('bootstrap.widgets.TbButton', array(
			'buttonType' => 'submit',
			'htmlOptions' => array('name' => 'saveWeight'),
			'type' => 'secondary',
			'label' => '保存权重',
		));
		?>
	</div>
<?php $this->endWidget(); ?>